<?php
function covert_ipt($txt)
{
	$html = preg_replace('/［([^］]+)］/', '<input type="text" name="tt[]" required="required" maxlength="1" value="$1"/>', $txt);
	return $html;
}

$source_config = include 'config.php';
$invite_code = include 'invite_code.php';
$first = array(
	$source_config[0][0],
	$source_config[0][1],
	covert_ipt($source_config[0][2]),
);
?>
<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<link rel="stylesheet" href="css/style.css">
	<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="msapplication-tap-highlight" content="no"/>
	<script src="js/jquery-1.9.1.min.js"></script>
	<script src="js/hammer.min.js"></script>
	<script src="js/hammer-time.min.js"></script>
	<script src="js/html2canvas.js"></script>
	<script src="js/pic.js?r=<?php echo time(); ?>"></script>
	<script>
		var SOURCE_CONFIG = <?=json_encode($source_config);?>;
		(function (doc, win) {
					var docEl = doc.documentElement,
						resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
						recalc = function () {
							var clientWidth = docEl.clientWidth;
							if (!clientWidth) return;
							docEl.style.fontSize = 20 * (clientWidth / 320) + 'px';
						};

					if (!doc.addEventListener) return;
					win.addEventListener(resizeEvt, recalc, false);
					doc.addEventListener('DOMContentLoaded', recalc, false);
					recalc();
				})(document, window);
	</script>
</head>
<body>
<form class="page" method="POST" action="img.php">
	<input type="hidden" name="build" id="build">
	<input type="hidden" name="image" value=""/>
	<input type="file" name="f" id="f">

	<div id="building-wrap">
		<div class="cover">
			<img src="img/trans.png" class="t-img" id="transLateImg">
			<img class="u-img" id="uImg">
			<img src="img/p.png" alt="" class="prev-btn">
			<img src="img/n.png" alt="" class="next-btn">
			<span class="date"><?= date('m.d'); ?></span>

			<div class="txt" id="adTxt"><?= $first[2]; ?></div>
			<img src="<?= $first[0]; ?>" class="cover-img">
		</div>
		<div class="footer_patch">
			<img src="img/img_patch.png" alt="">
		</div>
	</div>

	<div class="desc">
		您已获得美学内测邀请码
		<strong><?= $invite_code; ?></strong>

		<p>
			挑选心仪的雄性：请下载美学APP<br/>
			或访问美学官网：<a href="http://www.meixueapp.com" target="_blank">www.meixueapp.com</a>
		</p>
	</div>

	<div class="op">
		<label for="f">上传头像</label>
		<input type="button" value="生成图片&radic;" id="submit-btn">
	</div>

	<!-- <a href="?r=<?php echo time(); ?>" style="padding:1rem; border:1px solid red;">刷新</a> -->
</form>
<div class="notice">
	<img src="img/notice.png">
</div>
<div class="loading">
	<img src="img/loading.gif">
</div>
<script src="js/job.js?r=<?= time(); ?>"></script>
<canvas id="canvas" style="height:0;"></canvas>
</body>
</html>